﻿@model Wicresoft.UnifyShow.Business.DeviceModel
@{
    ViewBag.Title = Model.Identify;
    Layout = "~/Views/Shared/_LayoutPerformance.cshtml";
}
<div class="main_right2">
    <div class="search2">
        <div class="search_bg2">
            <h2> <span>@Model.Type</span>的历史性能</h2>
            <input type="hidden" id="deviceID" value="@Model.ID" />
            <table border="0" cellpadding="0" cellspacing="0">
                <tbody>
                    <tr>
                        <td width="8%">设备的特性值：</td>
                        <td width="22%">  <input value="@Model.Identify"  readonly="readonly"class="InputStyle1" /></td>
                        <td width="8%">
                            <label>分类：</label>
                        </td>
                        <td width="22%">
                            <input value="@Model.Type"  readonly="readonly"class="InputStyle1" />
                        </td>
                    </tr>
                    <tr>
                        <td width="8%">
                            <label>项目：</label>
                        </td>
                        <td width="22%">
                            <input value="@Model.Object"  readonly="readonly"class="InputStyle1" />
                        </td>
                        <td width="8%">
                            <label>
                                子项目：</label>
                        </td>
                        <td width="22%">
                            <input value="@Model.SubObject"  readonly="readonly" class="InputStyle1" />
                        </td>
                    </tr>
                    <tr>
                        <td width="8%">
                            <label>
                                开始时间：</label>
                        </td>
                        <td width="22%">
                            <input id="startTime" class="InputStyle1" />
                        </td>
                        <td width="8%">
                            <label>
                                结束时间：</label>
                        </td>
                        <td width="22%">
                            <input id="endTime" class="InputStyle1" />
                        </td>
                    </tr>
                </tbody>
            </table>
            <p>
                <input type="button" id="generateDeviceReport" value="查看" class="Button2 ui-icons" />
            </p>
        </div>
    </div>
    <div id="reportContent" class="index_lr_tab2">
    </div>
</div>
@section ScriptAndCss
{
    <script type="text/javascript">
        function initTheReport()
        {
            $('.report').load(function(){
             $(this).parent().hideLoading();
            }).error(function(){
            $(this).parent().hideLoading();
            });
            $('.report').each(function()
            {
              var url="@Url.Action("ReportParitalView", "Performance")";
              url+="?deviceID="+$("#deviceID").val()+"&parameterDisplay="+$(this).attr("data-parameter")+"&startTime="
              +$("#startTime").val()+"&endTime="+$("#endTime").val()+"&_="+Math.floor((Math.random()*1000000000)+1);
              $(this).attr("src",encodeURI(url));
              $(this).parent().showLoading();
            });
        }

        $(document).ready(function () {
           var x=$("#generateDeviceReport");

            $("#generateDeviceReport").click(function () {
            var url="@Url.Action("ContentParitalView", "Performance")";
            url+="?deviceID="+$("#deviceID").val()+"&startTime="+$("#startTime").val()+"&endTime="+$("#endTime").val();
            $("#reportContent").load(url,function()
            {
            initTheReport();
            });
            });
            $("#startTime").val(getDateString(new Date(new Date().getTime() - 3600 * 24 * 7 * 1000)));
            $("#endTime").val(getDateString(new Date()));

            $("#startTime").datepicker();
            $("#endTime").datepicker();
            $("#generateDeviceReport").click();
        });

    </script>
}
